<?php
require_once('backend.php');

$f = unserialize($_SESSION['forms']['login']);
unset($_SESSION['forms']);
$f->read_values();
if($f->check()){
    $u = new user();
    if($u->login($_POST['l_login'], $_POST['l_pass'])){
        unset($_SESSION['login_tryes']);
    }else{
        $_SESSION['login_tryes']++;
        $_SESSION['errmsg']['login']= array("Логин/пароль не опознаны");
        if($_SESSION['login_tryes'] > 2){
            unset($_SESSION['login_tryes']);
            Header("Location: /passremind");
            exit();
        }
    }
    header("Location: ".$_SERVER['HTTP_REFERER']);
}else{
    header("Location: ".$_SERVER['HTTP_REFERER']);
}
?>
